﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="WindowDialogService.cs" company="Concept Architecture">
//   (c) 2010 Muhammad Umer Farooq
// </copyright>
// <summary>
//   Defines the WindowDialogService type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Hisaab.Windows.Client
{
    using System.Windows.Forms;
    using Common;
    using View;
    using MessageBox = System.Windows.Forms.MessageBox;

    /// <summary>
    /// Defines the <seealso cref="Hisaab.Windows.Client.WindowDialogService"/> type.
    /// </summary>
    public class WindowDialogService : IWindowDialogService
    {
        /// <summary>
        /// Shows the dialog.
        /// </summary>
        /// <param name="title">The title.</param>
        /// <param name="datacontext">The datacontext.</param>
        /// <returns>Dialog result</returns>
        public bool? ShowDialog(string title, object datacontext)
        {
            var dialog = new WindowDialog { Title = title, DataContext = datacontext };
            return dialog.ShowDialog();
        }

        /// <summary>
        /// Shows the message.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="title">The title.</param>
        /// <param name="messageBoxButtons">The message box buttons.</param>
        /// <param name="messageBoxIcon">The message box icon.</param>
        /// <returns>Message box result</returns>
        public DialogResult ShowMessage(string message, string title, MessageBoxButtons messageBoxButtons, MessageBoxIcon messageBoxIcon)
        {
            return MessageBox.Show(message, title, messageBoxButtons, messageBoxIcon);
        }
    }
}